
# for elf_file in `find /mnt/soft/eda/synopsys/vcs/N-2017.12-SP2/linux64/bin -type f `
# for elf_file in `find /mnt/soft/eda/synopsys/vcs/N-2017.12-SP2/linux -type f `
# for elf_file in `find /mnt/soft/eda/synopsys/vcs/N-2017.12-SP2/linux64 -type f `

ELF_DIR=/mnt/soft/eda/synopsys/verdi/Verdi_N-2017.12-SP2/platform/linux64/bin

for elf_file in `find $ELF_DIR -type f `
do
	if (echo $elf_file |grep -F '.org' &>/dev/null ); then
		# echo $elf_file
		# ./patch-elf-bfd $elf_file --func vcs_checkout 31c0c3
		# break
		continue
	fi
	# continue

	if(readelf -h $elf_file &>/dev/null); then
		echo "========"
		# if (./patch-elf-bfd $elf_file --key 83ec10ff74242868........ff74242cff74242cff74242cff74242cff74242c 31c0c3 &>/dev/null); then
		# 	# echo $elf_file
		# 	if [ ! -e ${elf_file}.org ]; then
		# 		cp $elf_file ${elf_file}.org
		# 	fi
		# 	continue
		# fi
		# vcs 2017.12.sp2 x64
		# ./patch-elf-bfd $elf_file --key 4883ec1041514c8d0d........e85e4001004883c418c3660f1f840000000000 31c0c3 
		# # --func vcs_checkout 31c0c3
		# vcs 2017.12.sp2 x86
		# ./patch-elf-bfd $elf_file w --key 83ec10ff74242868........ff74242cff74242cff74242cff74242cff74242c 31c0c3 
		./patch-elf-bfd $elf_file --func snsCheckOut 31c0c3 
		# --func scl_lc_ch_init c3
	fi
	continue
	if (grep vcs_checkout $elf_file &>/dev/null); then
		echo $elf_file
		# if [ ! -e ${elf_file}.org ]; then
		# 	cp $elf_file ${elf_file}.org
		# fi
		./patch-elf-bfd $elf_file --func vcs_checkout 31c0c3
	fi

done
